﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using Yeap.Config;

namespace Yeap.Kernel.Storage
{
    public class SiteRepository : RepositoryBase<SiteSetting>, ISiteRepository
    {
        #region Implementation of ISiteRepository

        public string GetSetting(string settingName)
        {
            var setting = Query(ss => ss.SettingName == settingName).FirstOrDefault();

            if (setting == null)
            {
                throw  new Exception(Constants.ExceptionMessages.UnknownSiteSetting);
            }
            
            return setting.SettingValue;
        }

        #endregion
    }
}